package org.jeecgframework.web.material.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.web.system.pojo.base.TSUser;

/**   
 * @Description: 产品分类
 * @date 2015-08-18 14:11:27
 * @version V1.0   
 *
 */
@Entity
@Table(name = "p_type", schema = "")
@SuppressWarnings("serial")
public class PTypeEntity implements java.io.Serializable {
	//产品分类编号
	private java.lang.String id;
	//产品分类名称
	@Excel(name="产品分类")
	private java.lang.String name;
	//分类所处的层级
	private java.lang.Integer level;
	//产品分类父结点ID
	private PTypeEntity parentId;
	//创建人
	private TSUser createMan;
	//创建时间
	private java.util.Date createDate;
	//产品分类描述
	private java.lang.String description;
	//分类备注
	private java.lang.String remark;
	
	private List<PTypeEntity> childPtypes = new ArrayList<PTypeEntity>();
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parentId")
	public List<PTypeEntity> getChildPtypes() {
		return childPtypes;
	}
	public void setChildPtypes(List<PTypeEntity> childPtypes) {
		this.childPtypes = childPtypes;
	}
	/**
	 *get方法: 取得产品分类编号
	 */
	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name ="ID",nullable=false,length=32)
	public java.lang.String getId(){
		return this.id;
	}

	/**
	 *set方法: 设置产品分类编号
	 */
	public void setId(java.lang.String id){
		this.id = id;
	}
	/**
	 *get方法: 取得产品分类名称
	 */
	@Column(name ="NAME",nullable=true,length=45)
	public java.lang.String getName(){
		return this.name;
	}

	/**
	 *set方法: 设置产品分类名称
	 */
	public void setName(java.lang.String name){
		this.name = name;
	}
	/**
	 *get方法: 取得分类所处的层级
	 */
	@Column(name ="LEVEL",nullable=false,length=10)
	public java.lang.Integer getLevel(){
		return this.level;
	}

	/**
	 *set方法: 设置分类所处的层级
	 */
	public void setLevel(java.lang.Integer level){
		this.level = level;
	}
	/**
	 *get方法: 取得产品分类父结点ID
	 */
	@JsonIgnore// getList查询转换为列表时处理json转换异常
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "PARENT_ID")
	public PTypeEntity getParentId(){
		return this.parentId;
	}

	/**
	 *set方法: 设置产品分类父结点ID
	 */
	public void setParentId(PTypeEntity parentId){
		this.parentId = parentId;
	}
	/**
	 *get方法: 取得创建人
	 */
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "CREATE_MAN")
	@NotFound(action=NotFoundAction.IGNORE)
	public TSUser getCreateMan(){
		return this.createMan;
	}

	/**
	 *set方法: 设置创建人
	 */
	public void setCreateMan(TSUser createMan){
		this.createMan = createMan;
	}
	/**
	 *get方法: 取得创建时间
	 */
	@Column(name ="CREATE_DATE",nullable=true)
	public java.util.Date getCreateDate(){
		return this.createDate;
	}

	/**
	 *set方法: 设置创建时间
	 */
	public void setCreateDate(java.util.Date createDate){
		this.createDate = createDate;
	}
	/**
	 *get方法: 取得产品分类描述
	 */
	@Column(name ="description",nullable=true,length=45)
	public java.lang.String getDescription(){
		return this.description;
	}

	/**
	 *set方法: 设置产品分类描述
	 */
	public void setDescription(java.lang.String description){
		this.description = description;
	}
	/**
	 *get方法: 取得分类备注
	 */
	@Column(name ="REMARK",nullable=true,length=45)
	public java.lang.String getRemark(){
		return this.remark;
	}

	/**
	 *set方法: 设置分类备注
	 */
	public void setRemark(java.lang.String remark){
		this.remark = remark;
	}
}
